@extends('mobile.layout')
@php
    $layout_header = 1;
    $breadcrumb = [
        ['name'=>"ILIA資訊",'url'=>url('news')],
        ['name'=>\Illuminate\Support\Str::limit($new->title,35),'url'=>url()->current()],
    ];
@endphp
@if($new->seo_title)
    @section('title', $new->seo_title)
@else
    @section('title', $new->title)
@endif

@if($new->seo_keyword)
    @section('keywords', $new->seo_keyword)
@endif

@if($new->seo_description)
@section('description', $new->seo_description)
@endif

@section('style')
    @parent
    <link rel="stylesheet" type="text/css" href="{{ asset('static/mobile/css/news-desc.css') }}?v={{ app('cache.config')->get('asset_version') }}"/>
    <style>
        {!! \App\Services\ConfigService::get('news_css') !!}
    </style>
@stop

<script>
    document.domain = "ilia-online.com";
    function setIframeHeight(iframe) {
        if (iframe) {
            var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
            if (iframeWin.document.body) {
                iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
            }}
    };
    window.onload = function () {
        setIframeHeight(document.getElementById('external-frame'));
    };
</script>
@section('content')
    <div class="container clearfix">
        <div class="main">
            <div class="news">
                <div class="page-heading">
                    <h1 class="page-title">{{ $new->title }}</h1>
                    <ul class="breadcrumb">
                        <li><a href="/">首頁</a></li>
                        <li><a href="{{ url('news') }}">ILIA資訊</a></li>
                        <li><a href="{{ url()->current() }}">{{ \Illuminate\Support\Str::limit($new->title,28) }}</a></li>
                    </ul>
                </div>

                <div class="division">

                    <span class="time">{{ $new->release_at->format('Y-m-d') }}</span>
                </div>
                <div class="news-content">
                    @if($new->html_file)
                        <iframe id="external-frame" width="100%" style="min-height: 500px" src="{{ asset_upload(str_replace('.zip','',$new->html_file).'/index.html') }}"  frameborder="0" scrolling="no" onload="setIframeHeight(this)"></iframe>
                    @else
                        {!! $new->content !!}
                    @endif
                </div>
            </div>
        </div>

    </div>
@endsection
